package file;

import java.io.File;
import java.io.FileFilter;

/**
    获取file包中大小超过1000字节的所有子项
    输出这些子项的名字和实际占用的字节数

 */
public class Test03 {
    public static void main(String[] args) {
        File file = new File("./tedu-javase02/src/file");
        if (file.isDirectory()) {
            File[] subs = file.listFiles(new FileFilter() {
                public boolean accept(File pathname) {
                    return file.length() > 1000;
                }
            });
            for (int i = 0; i < subs.length; i++) {
                System.out.println(subs[i].getName() + ":" + subs[i].length());
            }
        }
    }
}
